<template>
	<view class="container">
		<view class="left-bottom-sign"></view>
		<!-- <view class="back-btn yticon icon-zuojiantou-up" @click="navBack"></view> -->
		<view class="right-top-sign"></view>
		<view class="background" />
		<view class="wrapper">
			<!-- 小程序登录授权界面 -->
			<!-- #ifdef MP -->
			<form class="loginForm">
				<title class="loginTitle">请输入您的登录信息</title>
				<item class="loginItem">
					<input class="weui-input" v-model="idCard" name="input" maxlength="18" placeholder="请输入身份证号" />
				</item>
				<item class="loginItem">
					<input class="weui-input" v-model="name" maxlength="6" name="input" placeholder="请输入病例姓名" />
				</item>
				<button class="confirm-btn" @click="login">登录</button>
			</form>
			<!-- #endif -->
		</view>
		<view class="register-section">
			还没有账号?
			<text @click="toRegist">马上注册</text>
		</view>
	</view>
</template>

<script>
	import {
		getPatientByIdCardAndName
	} from '@/api/login/index.js';
	
	export default {
		data() {
			return {
				idCard: '430281200106108801',
				name: '王老师'
			};
		},
		computed: {

		},
		onLoad() {

		},
		methods: {
			//登录方法
			login(){
				getPatientByIdCardAndName(this.idCard,this.name).then(result =>{
					if(result.data != null){
							uni.setStorageSync('patient', result.data);
							uni.showToast({
								title: '登录成功',
								icon: 'none'
							});
							setTimeout(() => {
								uni.reLaunch({
									url: `/pages/index/index` // 跳转目标页面的路径
								})
							},1000)
						}else{
							uni.showToast({
								title: '登录失败,身份信息不正确',
								icon: 'none'
							});
						}
				})
			},
			//注册
			toRegist(){
				uni.reLaunch({
					url: '/pages/regist/index'
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background: #fff;
	}

	//display: flex; justify-content: center; align-items: center;
	page {
		.loginItem {
			display: flex;
			width: 320px;
			height: 70upx;
			align-items: center;
			margin-bottom: 25px;
			border-radius: 5px;
			background: #F3F4F6;
		}

		.loginTitle {
			display: flex;
			justify-content: center;
			align-items: center;
			margin-bottom: 40px;
		}

		.loginForm {
			width: 100%;
			height: 100%;
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;
		}

		.weui-input {
			margin-left: 12px;
		}

		.background {
			width: 100%;
			height: 170px;
			background-color: #88CDEA;
		}
	}

	.confirm-btn {
		// width: 100%;
		height: 80upx;
		line-height: 80upx;
		border-radius: 50px;
		// margin-top: 70upx;
		background: $uni-color-primary;
		color: #fff;
		font-size: $font-lg + 2upx;
	}

	.container {
		// padding-top: 75px;
		position: relative;
		width: 100vw;
		height: 100vh;
		overflow: hidden;
		background: #F2F2F4;
	}

	.wrapper {
		width: 370px;
		height: 300px;
		position: absolute;
		top: 80px;
		left: 10px;
		z-index: 9999;
		background: #fff;
		// padding-bottom: 40upx;
		border-radius: 5px;
	}

	.back-btn {
		position: absolute;
		left: 40upx;
		z-index: 9999;
		// padding-top: var(--status-bar-height);
		top: 40upx;
		font-size: 40upx;
		color: $font-color-dark;
	}

	.left-top-sign {
		font-size: 120upx;
		color: $page-color-base;
		position: relative;
		left: -16upx;
	}

	.right-top-sign {
		position: absolute;
		top: 80upx;
		right: -30upx;
		z-index: 95;

		&:before,
		&:after {
			display: block;
			content: '';
			width: 400upx;
			height: 80upx;
			background: #b4f3e2;
		}

		&:before {
			transform: rotate(50deg);
			border-radius: 0 50px 0 0;
		}

		&:after {
			position: absolute;
			right: -198upx;
			top: 0;
			transform: rotate(-50deg);
			border-radius: 50px 0 0 0;
			/* background: pink; */
		}
	}

	.left-bottom-sign {
		position: absolute;
		left: -270upx;
		bottom: -320upx;
		border: 100upx solid #d0d1fd;
		border-radius: 50%;
		padding: 180upx;
	}

	.welcome {
		position: relative;
		left: 50upx;
		top: -90upx;
		font-size: 46upx;
		color: #555;
		text-shadow: 1px 0px 1px rgba(0, 0, 0, 0.3);
	}

	.input-content {
		padding: 0 60upx;
	}

	.input-item {
		display: flex;
		flex-direction: column;
		align-items: flex-start;
		justify-content: center;
		padding: 0 30upx;
		background: $page-color-light;
		height: 120upx;
		border-radius: 4px;
		margin-bottom: 50upx;

		&:last-child {
			margin-bottom: 0;
		}

		.tit {
			height: 50upx;
			line-height: 56upx;
			font-size: $font-sm + 2upx;
			color: $font-color-base;
		}

		input {
			height: 60upx;
			font-size: $font-base + 2upx;
			color: $font-color-light;
			width: 100%;
		}
	}

	.sms-code-btn {
		position: absolute;
		right: 0;
		border: none;
		color: #ccc;
		background: transparent;
		font-size: 14px;
	}

	.correct_phone_number {
		color: #000;
	}


	.confirm-btn {
		width: 320px;
		height: 76upx;
		line-height: 76upx;
		border-radius: 50px;
		// margin-top: 70upx;
		background: $uni-color-login;
		color: #fff;
		font-size: $font-lg;

		&:after {
			border-radius: 100px;
		}
	}

	.forget-section {
		font-size: $font-sm + 2upx;
		color: $font-color-spec;
		text-align: center;
		margin-top: 40upx;
	}

	.register-section {
		position: absolute;
		left: 0;
		bottom: 50upx;
		width: 100%;
		font-size: $font-sm + 2upx;
		color: $font-color-base;
		text-align: center;

		text {
			color: $font-color-spec;
			margin-left: 10upx;
		}
	}

	.tip {
		margin-top: 60upx;
		font-size: $font-base - 4upx;
		color: $font-color-dark;
		text-align: center;
		font-family: yticon;
		font-weight: bold;
	}
</style>